import request from '@/http/request'
const apiUrl = 'bf-finance'

// -----------租赁相关接口----------
export const leaseApi = {
    getAllAssets: () => request.get(`${apiUrl}/lease/getAllAssets`), // 资产下拉框查询
    getAssetsLeasePage: (param) => request.post(`${apiUrl}/lease/getAssetsLeasePage`, param), // 分页查询租赁客户
    getLeaseStatistics: () => request.get(`${apiUrl}/lease/getLeaseStatistics`), // 管理界面金额统计
    getLeaseCustomer: (id) => request.get(`${apiUrl}/lease/getLeaseCustomer?contractId=${id}`), // 详情页查询客户及对应的资产信息
    getLeaseHousing: (id) => request.get(`${apiUrl}/lease/getLeaseHousing?contractId=${id}`), // 详情页查询租赁房源明细
    getRentPlan: (id) => request.get(`${apiUrl}/lease/getRentPlan?contractId=${id}`), // 详情页查询合同的租金计划信息
    getLeaseContract: (id) => request.get(`${apiUrl}/lease/getLeaseContract?contractId=${id}`), // 详情页查询合同信息
    getCollectionHistory: (param) => request.get(`bf-assets/leaseManage/getCollectionHistory/${param.contractId}`), //租赁管理-->核销历史
    getReceivableCollectionInfo: (param) => request.get(`bf-assets/leaseManage/getReceivableCollectionInfo/${param.contractId}`),//租赁管理-->应收核销详情
    contractCollectionAdd: (param) => request.post(`bf-assets/leaseManage/contractCollectionAdd`, param),// 租赁管理-->应收核销,
    getRefundableCollectionInfo: (param) => request.get(`bf-assets/leaseManage/getRefundableCollectionInfo/${param.contractId}`),//租赁管理-->应退核销详情
    contractRefundableCollection: (param) => request.post(`bf-assets/leaseManage/contractRefundableCollection`, param),// 租赁管理-->应退核销,
    getPropertyTerminationAgreement: (param) => request.get(`bf-assets/leaseManage/getPropertyTerminationAgreement/${param.contractId}/${param.templateUrlKey}`),//租赁管理-->物业交割协议获取
    submitForReview: (param) => request.post(`bf-assets/leaseManage/submitForReview/${param.contractId}`,param.data),// 租赁管理-->物业验收-->提交审批
    preview: (param) => request.post(`bf-assets/leaseManage/preview/${param.contractId}/${param.templateUrlKey}`,param.data),// 租赁管理-->物业验收-->提交审批
    getDepositCollectionInfo: (param) => request.get(`bf-assets/leaseManage/getDepositCollectionInfo/${param.contractId}`),// 租赁管理-->物业验收-->押金审核
    submitDepositCancellation:(data) => request.post(`bf-assets/leaseManage/getDepositCollection`,data),// 租赁管理-->物业验收--> 提交押金审批
    getInvoiceList:(data) => request.post(`bf-assets/invoice/getListPage`,data),// 租赁管理-->开票管理--->查询发票信息
    getInvoicingInfo: (param) => request.get(`bf-assets/invoicingInformation/findone/${param.contractId}`),// 租赁管理-->查询开票信息
    saveInvoicingInfo:(data) => request.post(`bf-assets/invoicingInformation/save`,data),// 租赁管理-->开票管理--->新增/保存 开票信息
    getUserList: () => request.get(`bf-assets/invoice/getUserList`),// // 租赁管理--->财务人员
}

// -----------租赁首页相关接口----------
export const homeApi = {
    getDefault: (param) => request.post(`bf-assets/leaseManage/getDefault`, param),// 首页默认数据查询
    getReceivables: (param) => request.post(`bf-assets/leaseManage/getReceivables`, param),// 首页应收款数据查询
    getRefund: (param) => request.post(`bf-assets/leaseManage/getRefund`, param),// 首页应退款数据查询
    getListPage: (param) => request.post(`bf-assets/leaseManage/getListPage`, param),// 首页租赁管理-->列表
}

// -----------租赁发票相关接口----------
export const invoiceApi = {
    add: (param) => request.post(`bf-assets/invoice/addone`, param),// 新增
    update: (param) => request.post(`bf-assets/invoice/updateOne`, param),// 修改
    cancelInvoice: (param) => request.post(`bf-assets/invoice/cancelInvoice`, param),//作废
    addHongChong: (param) => request.post(`bf-assets/invoice/addHongChong`, param),//红冲
    cancelHongChong: (businessId) => request.get(`bf-assets/invoice/cancelHongChong/${businessId}`),// 取消红冲
    cancelCancelInvoice: (businessId) => request.get(`bf-assets/invoice/cancelCancelInvoice?businessId=${businessId}`),// 取消发票作废
}

export const otherApi = {
    uploadFile:(data) => request({ url:'bf-assets/leaseManage/upload',method:'post',data}),//文件上传
    downloadFile:(data) => request({ url:'bf-assets/leaseManage/download',method:'post',data,responseType:'blob'}),//文件下载
}
